package com.fjh.impl;

import com.fjh.dao.BorrowDao;
import com.fjh.pojo.Borrow;
import com.fjh.service.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class BorrowServiceImpl implements BorrowService {
    private final BorrowDao borrowDao;

    @Autowired
    public BorrowServiceImpl(BorrowDao borrowDao) {
        this.borrowDao = borrowDao;
    }

    @Override
    @Transactional
    public void borrowBook(Borrow borrow) {
        borrowDao.borrowBook(borrow);
    }

    @Override
    @Transactional
    public void returnBook(int borrowId) {
        borrowDao.returnBook(borrowId);
    }
}